package com.base.framework.config.plugin;


import com.base.framework.config.IDataSource;
import com.base.framework.utils.file.PropertiesUtil;
import com.jfinal.plugin.druid.DruidPlugin;

public class DruidConfigImpl extends PropertiesUtil implements IDataSource<DruidPlugin> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 6429740738766789843L;

	@Override
	public DruidPlugin getDsConfig() {
		// 加载配置文件
		loadPropertyFile("config/DruidConfig.properties");
		DruidPlugin dp = new DruidPlugin(getProperty("jdbcurl"),
				getProperty("username"), getProperty("password"));
		dp.setDriverClass(getProperty("driverClassName"));
		dp.setFilters(getProperty("filters"));
		dp.setMaxActive(getPropertyToInt("maxActive"));
		dp.setInitialSize(getPropertyToInt("initialSize"));
		dp.setMaxWait(getPropertyToInt("maxWait"));
		dp.setMinIdle(getPropertyToInt("minIdle"));
		return dp;

	}

}